//KLB - C2 start
#ifndef OTHERKLB_H
#define OTHERKLB_H

#include <vector>
#include "Product.h"
#include "Cart_item.h"
#include "Chrono.h"
#include <iostream>

using namespace Chrono;

class OtherKLB
{
public:
        static void listProdNames( vector<Product> prods, vector<Cart> carts, vector<Cart_item> cartItems)
        {//asks for cart_id and lists the product name and total price
                int cart_id;
                cout << "please enter a cart_id: ";
                cin >> cart_id;
                
                for(int i =0; i < cartItems.size(); i++)
                {
                        if( cart_id == cartItems[i].cart_get())
                        {
                                for(int j =0; j < prods.size(); j++)
                                {
                                        if( cartItems[i].prod_get() == prods[j].id_get())
                                        {
                                                double totalPrice = prods[j].price_get() * cartItems[i].qty_get();
                                                cout << prods[j].name_get() << " " << totalPrice << endl;
                                        }
                                }
                        }
                }
        }
        static void addCart(vector<Cart> &carts)
        {//adds a new cart id to the given customer and date
                int cart_id, cust_id, year, month, day;
                cout << "please enter a cart id: ";
                cin  >> cart_id;
                cout << "\nPlease enter a Customer ID: ";
                cin  >> cust_id;
                cout << "\nPlease enter a year: ";
                cin  >> year;
                cout << "\nPlease enter a month: ";
                cin  >> month;
                cout << "\nPlease enter a day: ";
                cin  >> day;
                Date x(year, Date::Month(month), day);
                Cart newCart(cart_id, cust_id, x);
                carts.push_back(newCart);
        }
        static void deleteCartItem(vector<Cart_item> &cartItems)
        {//deletes a cart item from cart
                int delCartItem;
                cout << "Please enter a Cart Item ID you wish to delete: \n";
                cin  >> delCartItem;
                vector<Cart_item>:: iterator fail = cartItems.begin();
                for(;fail != cartItems.end();++fail)
                {
                        if(delCartItem == (*fail).item_get())
                        {
                                cartItems.erase(fail);
                                cout<<"HAHA!! I DELETED YOU!!";
				break;
                        }
                }
                
        }
};
//KLB - C2 end
#endif
